package com.cmbdb.controller;

import com.cmbdb.core.common.AutoController;
import com.cmbdb.core.common.BaseService;
import com.cmbdb.entity.User;
import com.cmbdb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 注释
 *
 * @author: coding99
 * @Date: 17-3-3
 * @Time: 上午11:28
 */
@RestController
@RequestMapping("user")
public class UserController extends AutoController<User>{


    @Autowired
    public UserService userService;

    @Override
    protected BaseService getBaseService() {
        return userService;
    }

    @Override
    protected User getEntity(User user, String type) {
        if("add".equals(type)) {
            user.setRegistTime(new Date());
        }else if("edit".equals(type)) {
            user.setModifyTime(new Date());
        }
        return user;
    }




}
